// src/api/user.ts
import requestFunction from "../request";

interface ApiResponse<T = any> {
	code: number;
	data: T;
	msg?: string;
	trace_id?: string;
}
// 登录接口
export const userLogin = (params: {
	username: string;
	password: string;
}): Promise<
	ApiResponse<{
		token: string;
	}>
> => {
	return requestFunction("staffs/login", params, "post");
};

// 删除用户接口
export const userDel = (
	params: Record<string, any>,
	staff_id: string | number
): Promise<ApiResponse> => {
	return requestFunction(`staffs/${staff_id}`, params, "delete");
};

// 退出登录接口
export const userLogout = (
	params?: Record<string, any>
): Promise<ApiResponse> => {
	return requestFunction("staffs/logout", params, "post");
};
